package hhh.app.presenter.model.cart;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import hhh.app.data.bean.Cart;
import hhh.app.domain.interactor.GetCarts;
import hhh.app.domain.interactor.ProductCase;
import hhh.app.presenter.ui.base.BasePresenter;
import rx.Subscriber;

/**
 * Created by hhh on 2017/3/20.
 */
public class CartPresenter extends BasePresenter<CartContract.ICardView> implements CartContract.ICardPresenter {
    private GetCarts getCarts;

    @Inject
    public CartPresenter(@Named("carts") ProductCase getCarts) {
        if(getCarts instanceof GetCarts){
            this.getCarts= (GetCarts) getCarts;
        }else{
            this.getCarts=null;
        }
    }

    @Override
    public void loadCards(int uid) {
        if(getCarts!=null){
            getCarts.setUid(uid).execute(new Subscriber<List<Cart>>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {

                }

                @Override
                public void onNext(List<Cart> list) {

                }
            });
        }
    }
}
